<template>
  <TnTabbar v-model="active" fixed>
    <TnTabbarItem v-for="(item, index) in tabbarData" :key="index" :icon="item.icon" :active-icon="item.activeIcon"
      :text="item.name" @click="navigator(item.path)" />
  </TnTabbar>
</template>

<script setup lang="ts">
import TnTabbar from '@tuniao/tnui-vue3-uniapp/components/tabbar/src/tabbar.vue'
import TnTabbarItem from '@tuniao/tnui-vue3-uniapp/components/tabbar/src/tabbar-item.vue'
import { ref } from 'vue'
const props = defineProps<{
  currentTabbar: number | string
}>()

const active = ref(props.currentTabbar)

// 导航栏数据
const tabbarData = [
  {
    name: '访客记录',
    icon: 'fire',
    activeIcon: 'fire-fill',
    path: '/pages/index/index'
  },
  {
    name: '个人中心',
    icon: 'my-circle',
    activeIcon: 'my-circle-fill',
    path: '/pages/my/index'
  },
]
// 隐藏底部默认导航栏
uni.hideTabBar()
const navigator = (path: string) => {
  uni.switchTab({
    url: path
  })
}
</script>
